package model;

import java.io.Serializable;
import javax.persistence.*;
import java.util.List;


/**
 * The persistent class for the CUSTOMER_REPRESENTATIVE database table.
 * 
 */
@Entity
@Table(name="CUSTOMER_REPRESENTATIVE")
public class CustomerRepresentative implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@Column(name="CUST_REP_ID")
	private long custRepId;

	//bi-directional one-to-one association to Employee
	@OneToOne
	@JoinColumn(name="CUST_REP_ID")
	private Employee employee;

	//bi-directional many-to-one association to Territory
	@ManyToOne
	@JoinColumn(name="TERRITORY_ID")
	private Territory territory;

	//bi-directional many-to-one association to CustComplaint
	@OneToMany(mappedBy="customerRepresentative")
	private List<CustComplaint> custComplaints;

	public CustomerRepresentative() {
	}

	public long getCustRepId() {
		return this.custRepId;
	}

	public void setCustRepId(long custRepId) {
		this.custRepId = custRepId;
	}

	public Employee getEmployee() {
		return this.employee;
	}

	public void setEmployee(Employee employee) {
		this.employee = employee;
	}

	
	public Territory getTerritory() {
		return this.territory;
	}

	public void setTerritory(Territory territory) {
		this.territory = territory;
	}

	
	public List<CustComplaint> getCustComplaints() {
		return this.custComplaints;
	}

	public void setCustComplaints(List<CustComplaint> custComplaints) {
		this.custComplaints = custComplaints;
	}

	
	public CustComplaint addCustComplaints(CustComplaint custComplaints) {
		getCustComplaints().add(custComplaints);
		custComplaints.setCustomerRepresentative(this);

		return custComplaints;
	}

	public CustComplaint removeCustComplaints(CustComplaint custComplaints) {
		getCustComplaints().remove(custComplaints);
		custComplaints.setCustomerRepresentative(null);

		return custComplaints;
	}
}